#include <stdio.h>
#include <unistd.h>

int main()
{
    int fd;

    printf("fileno: %d \n", fileno(stdout));

    int ret = isatty(fileno(stdout));
    printf("%d\n", ret);
    if(ret == 0){
        fprintf(stderr, "stdout is not terminal\n");
    }

    fd = open("abc.txt", 0);

    ret = isatty(fd);
    printf("%d\n", ret);

    close(fd);

    return 0;
}